﻿@{
    ViewBag.Title = "账号管理";
    ViewBag.PathToBtn = "/MagUser/Create";
    ViewBag.TextBtn = "添加新账号";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section css{

}
<!-- /.row -->
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                账号列表
            </div>
            <!-- /.panel-heading -->
            <div class="panel-body">
                <div class="dataTable_wrapper">
                    <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                        <thead>
                            <tr>
                                <th>角色</th>
                                <th>电话</th>
                                <th>名称</th>
                                <th>用户名</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>                           
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

@section javascript{
    <script src="/Content/admin/dist/js/pagingHelper.js"> </script>
    <script type="text/javascript">
        var dataParams = {};
        var serverProcessPath = "/MagUser/Listing";
        var showColumns = [
            { data: "RoleName" },
            { data: "Mobile" },
            { data: "RealName" },
            { data: "UserName" },
            { data: "Action" }
        ];
        pagingHelper.Paging(serverProcessPath, dataParams, showColumns);

        function updateData(id) {
            document.location.href = '/MagUser/Update/' + id;
        }

        function deleteData(id) {
            alertify
                .okBtn("确定")
                .cancelBtn("取消")
                .confirm("确定要删除该数据吗？", function () {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/MagUser/Delete',
                    data: { doIds: id },
                    success: function (result) {
                        if (result) {
                            alertify.success("数据删除成功");
                            setTimeout("pagingHelper.reload()", 500);
                        } else {
                            alertify.error("数据删除失败");
                        }
                    }
                });
            }, function() {
                // user clicked "cancel"
            });
        }
    </script>
}